package com.lv.dhart.ui.fragment.fghome.inner.risk;

import android.content.Context;
import android.view.View;

import com.lv.dhart.R;
import com.lv.dhart.beans.RiskBeans;
import com.smart.holder.iinterface.IViewHolder;
import com.smart.holder.iinterface.IViewHolderHelper;

import java.util.List;

/**
 * Created by binny on 2018/6/1.
 * 历史上的今天
 */

public class RiskViewHolderHelper implements IViewHolderHelper<RiskViewHolder, RiskBeans.DataDTO> {


    @Override
    public IViewHolder initItemViewHolder(RiskViewHolder viewHolder, View convertView) {
        viewHolder = new RiskViewHolder();
        viewHolder.stock_code = convertView.findViewById(R.id.stock_code);
        viewHolder.stock_name = convertView.findViewById(R.id.stock_name);
        viewHolder.hold_focus = convertView.findViewById(R.id.hold_focus);
        viewHolder.ave_price = convertView.findViewById(R.id.ave_price);
        viewHolder.hold_risk = convertView.findViewById(R.id.hold_risk);
        viewHolder.holder_total_num = convertView.findViewById(R.id.holder_total_num);
        viewHolder.tc_count = convertView.findViewById(R.id.tc_count);
        viewHolder.jj_count = convertView.findViewById(R.id.jj_count);
        viewHolder.mArticleCardView = convertView.findViewById(R.id.article_card_view);
        return viewHolder;
    }

    @Override
    public void bindListDataToView(Context context, List<RiskBeans.DataDTO> list, RiskViewHolder viewHolder, int i) {
        viewHolder.stock_code.setText(list.get(i).getStockCode());
        viewHolder.stock_name.setText(list.get(i).getStockName());
        viewHolder.hold_risk.setText(list.get(i).getDangerType());
        viewHolder.hold_focus.setText(list.get(i).getHoldFocus());
        viewHolder.ave_price.setText("均价: " + list.get(i).getAvePrice());
        viewHolder.holder_total_num.setText("股东数量: " + list.get(i).getHolderTotalNum());
        viewHolder.tc_count.setText("题材数: " + list.get(i).getTcCount());
        viewHolder.jj_count.setText("机构数: " + list.get(i).getJjCount());
    }
}
